#pragma once
#include <Rz/Singleton.h>
#include <Rz/String.h>
#include <Rz/Types.h>

#ifdef RZ_INCLUDE_LOGGER
#	define RZ_LOG_TRACE(fmt, ...)	::Rz::Diagnostics::Logger::GetInstance().LogTrace(__FILE__, __LINE__, __FUNCTION__, fmt, __VA_ARGS__)
#	define RZ_LOG(...)				::Rz::Diagnostics::Logger::GetInstance().Log(__VA_ARGS__)
#	define RZ_LOG_SET_STREAM(s)		::Rz::Diagnostics::Logger::GetInstance().SetOutputStream(s)
#else
#	define RZ_LOG_TRACE(fmt, ...)
#	define RZ_LOG(fmt, ...)
#	define RZ_LOG_SET_STREAM(s)
#endif

#ifdef RZ_INCLUDE_LOGGER

namespace Rz { namespace Diagnostics {

class Logger final :
	public Singleton<Logger>
{
	friend class Singleton<Logger>;

	public:
		RZ_MARK_AS_SINGLETON(Logger);

		void Log(const char* format, ...);
		void LogTrace(const char* filename, int line, const char* fn, const char* format, ...);
		void SetOutputStream(FILE* stream);

	private:
		Logger();

		FILE* _stream;
};

} }

#endif
